package util;

/**
 * A class with static methods to do conversions and other math on geodata
 * @author Stephan
 *
 */
public class GeoMath
{
	/**
	 * The number of meters per foot
	 */
	private static final double METERS_PER_FOOT = 0.3048;
	/**
	 * The number of watts per BTU*Minute
	 */
	private static final double WATT_PER_BTU_MINUTE = 17.5843;
	/**
	 * The number of Joules per BTU
	 */
	private static final double JOULES_PER_BTU = 1055.056;
	
	/**
	 * You shan't create an instance of this class!!
	 */
	private GeoMath() { /* no instances of this class */ }

	
	/**
	 * Converts feet to meters, per the current rounding policy.
	 * 
	 * @param feet the number of feet to convert.
	 * @return the value in meters. 
	 */
	public static double feetToMeters(double feet)
	{
		return feet * METERS_PER_FOOT;
	}
	
	/**
	 * Converts meters to feet, per the current rounding policy.
	 * 
	 * @param meters the number of meters to convert.
	 * @return the value in feet.
	 */
	public static double metersToFeet(double meters)
	{
		return meters / METERS_PER_FOOT;
	}
	
	/**
	 * Converts degrees Fahrenheit to degrees Celsius.
	 * 
	 * @param fahrenheit the temperature in Fahrenheit.
	 * @return the temperature in Celsius.
	 */
	public static double fahrenheitToCelsius(double fahrenheit)
	{
		return (fahrenheit - 32) * 5.0/9.0;
	}
	
	/**
	 * Converts degrees Celsius to degrees Fahrenheit.
	 * 
	 * @param celsius the temperature in Celsius.
	 * @return the temperature in Fahrenheit.
	 */
	public static double celsiusToFahrenheit(double celsius)
	{
		return celsius * 9.00 / 5.0 + 32;
	}
	
	/**
	 * Converts degrees Celsius to Kelvin
	 * 
	 * @param celsius the temperature in Celsius
	 * @return the temperature in Kelvin
	 */
	public static double celsiusToKelvin(double celsius)
	{
		return celsius - 273;
	}
	
	/**
	 * Converts BTU/Minute to Watts
	 * @param BTUMin the BTU/Minute value
	 * @return the equivalent value in Watts
	 */
	public static double BTUMinToWatt(double BTUMin)
	{
		return BTUMin * WATT_PER_BTU_MINUTE;
	}
	
	/**
	 * Converts Watts to BTU/Minute
	 * @param watt the Wattage
	 * @return the equivalent value in BTU/Minute
	 */
	public static double wattToBTUMin(double watt)
	{
		return watt / WATT_PER_BTU_MINUTE;
	}
	
	/**
	 * Converts BTUs to Joules
	 * @param BTUs the BTU value
	 * @return the value in Joules
	 */
	public static double BTUToJoule(double BTUs)
	{
		return BTUs * JOULES_PER_BTU;
	}
	
	/**
	 * Converts Joules to BTUs
	 * @param joules the Joule value
	 * @return the value in BTUs
	 */
	public static double jouleToBTU(double joules)
	{
		return joules / JOULES_PER_BTU;
	}
	
}
